/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.factory;

import ru.jSkyRoom.bridge.stub.AIPackageBridge;
import ru.jSkyRoom.bridge.stub.AddictionBridge;
import ru.jSkyRoom.bridge.stub.AnimationBridge;
import ru.jSkyRoom.bridge.stub.ArtBridge;
import ru.jSkyRoom.bridge.stub.AudioTemplateBridge;
import ru.jSkyRoom.bridge.stub.CombatStyleBridge;
import ru.jSkyRoom.bridge.stub.CritEffectBridge;
import ru.jSkyRoom.bridge.stub.DualCastArtBridge;
import ru.jSkyRoom.bridge.stub.EffectShaderBridge;
import ru.jSkyRoom.bridge.stub.EquipSlotBridge;
import ru.jSkyRoom.bridge.stub.ExplosionBridge;
import ru.jSkyRoom.bridge.stub.FirstPersonModelBridge;
import ru.jSkyRoom.bridge.stub.GameLocationBridge;
import ru.jSkyRoom.bridge.stub.ImageSpaceModBridge;
import ru.jSkyRoom.bridge.stub.ImpactSetBridge;
import ru.jSkyRoom.bridge.stub.JSkyColorBridge;
import ru.jSkyRoom.bridge.stub.MaterialTypeBridge;
import ru.jSkyRoom.bridge.stub.NPCClassBridge;
import ru.jSkyRoom.bridge.stub.ResponseDataBridge;
import ru.jSkyRoom.bridge.stub.SkillBridge;
import ru.jSkyRoom.bridge.stub.SoundBridge;
import ru.jSkyRoom.bridge.stub.StaticObjectBridge;
import ru.jSkyRoom.bridge.stub.VoiceTypeBridge;
import ru.jSkyRoom.finder.FinderByFormIDStub;
import ru.jSkyRoom.finder.FinderByFormId;
import ru.jSkyRoom.finder.FromModByFormIdFinder;
import ru.jSkyRoom.interfaces.JSkyMod;
import ru.jSkyRoom.interfaces.major.ActorValue;
import ru.jSkyRoom.interfaces.major.Ammo;
import ru.jSkyRoom.interfaces.major.Armature;
import ru.jSkyRoom.interfaces.major.Armor;
import ru.jSkyRoom.interfaces.major.Book;
import ru.jSkyRoom.interfaces.major.Container;
import ru.jSkyRoom.interfaces.major.Dialog;
import ru.jSkyRoom.interfaces.major.DialogBranch;
import ru.jSkyRoom.interfaces.major.DialogView;
import ru.jSkyRoom.interfaces.major.Enchantment;
import ru.jSkyRoom.interfaces.major.EncounterZone;
import ru.jSkyRoom.interfaces.major.Faction;
import ru.jSkyRoom.interfaces.major.FormList;
import ru.jSkyRoom.interfaces.major.GameSetting;
import ru.jSkyRoom.interfaces.major.GlobalForm;
import ru.jSkyRoom.interfaces.major.HeadPart;
import ru.jSkyRoom.interfaces.major.ImageSpace;
import ru.jSkyRoom.interfaces.major.Info;
import ru.jSkyRoom.interfaces.major.Ingredient;
import ru.jSkyRoom.interfaces.major.Keyword;
import ru.jSkyRoom.interfaces.major.LeveledCharacter;
import ru.jSkyRoom.interfaces.major.LeveledItemList;
import ru.jSkyRoom.interfaces.major.Light;
import ru.jSkyRoom.interfaces.major.MagicEffect;
import ru.jSkyRoom.interfaces.major.Major;
import ru.jSkyRoom.interfaces.major.Miscellaneous;
import ru.jSkyRoom.interfaces.major.NPC;
import ru.jSkyRoom.interfaces.major.Outfit;
import ru.jSkyRoom.interfaces.major.Perk;
import ru.jSkyRoom.interfaces.major.Potion;
import ru.jSkyRoom.interfaces.major.Projectile;
import ru.jSkyRoom.interfaces.major.Quest;
import ru.jSkyRoom.interfaces.major.Race;
import ru.jSkyRoom.interfaces.major.Recipe;
import ru.jSkyRoom.interfaces.major.Scroll;
import ru.jSkyRoom.interfaces.major.Spell;
import ru.jSkyRoom.interfaces.major.Texture;
import ru.jSkyRoom.interfaces.major.Weapon;
import ru.jSkyRoom.interfaces.stub.AIPackage;
import ru.jSkyRoom.interfaces.stub.Addiction;
import ru.jSkyRoom.interfaces.stub.Animation;
import ru.jSkyRoom.interfaces.stub.Art;
import ru.jSkyRoom.interfaces.stub.AudioTemplate;
import ru.jSkyRoom.interfaces.stub.CombatStyle;
import ru.jSkyRoom.interfaces.stub.CritEffect;
import ru.jSkyRoom.interfaces.stub.DualCastArt;
import ru.jSkyRoom.interfaces.stub.EffectShader;
import ru.jSkyRoom.interfaces.stub.EquipSlot;
import ru.jSkyRoom.interfaces.stub.Explosion;
import ru.jSkyRoom.interfaces.stub.FirstPersonModel;
import ru.jSkyRoom.interfaces.stub.GameLocation;
import ru.jSkyRoom.interfaces.stub.ImageSpaceMod;
import ru.jSkyRoom.interfaces.stub.ImpactSet;
import ru.jSkyRoom.interfaces.stub.JSkyColor;
import ru.jSkyRoom.interfaces.stub.JSkySound;
import ru.jSkyRoom.interfaces.stub.MaterialType;
import ru.jSkyRoom.interfaces.stub.NPCClass;
import ru.jSkyRoom.interfaces.stub.ResponseData;
import ru.jSkyRoom.interfaces.stub.Skill;
import ru.jSkyRoom.interfaces.stub.StaticObject;
import ru.jSkyRoom.interfaces.stub.VoiceType;
import ru.jSkyRoom.manager.ModManager;
import ru.jSkyRoom.support.GrupTypeBuilder;
import skyproc.FormID;
import skyproc.GRUP_TYPE;

/**
 *
 * @author Rakev
 */
public class FinderByFormIdFactory {

    private final static FinderByFormIdFactory instance = new FinderByFormIdFactory();

    public static FinderByFormIdFactory create() {
        return instance;
    }

    protected FinderByFormIdFactory() {
    }

    private JSkyMod getLookingMod() {
        return ModManager.getInstance().getAllModsComposite();
    }

    protected <T extends Major> FinderByFormId<T> createFinder(GRUP_TYPE... lookingGrups) {
        return new FromModByFormIdFinder<>(getLookingMod(), lookingGrups);
    }

    public FinderByFormId<Major> createMajorFinder() {
        GrupTypeBuilder grupTypeBuilder = new GrupTypeBuilder().All();
        GRUP_TYPE[] lookingGrups = grupTypeBuilder.build();
        return createFinder(lookingGrups);
    }

    public FinderByFormId<Keyword> createKeywordFinder() {
        return createFinder(GRUP_TYPE.KYWD);
    }

    public FinderByFormId<FormList> createFormListFinder() {
        return createFinder(GRUP_TYPE.FLST);
    }

    public FinderByFormId<Armor> createArmorFinder() {
        return createFinder(GRUP_TYPE.ARMO);
    }

    public FinderByFormId<Weapon> createWeaponFinder() {
        return createFinder(GRUP_TYPE.WEAP);
    }

    public FinderByFormId<Enchantment> createEnchantmentFinder() {
        return createFinder(GRUP_TYPE.ENCH);
    }

    public FinderByFormId<Armature> createArmatureFinder() {
        return createFinder(GRUP_TYPE.ARMA);
    }

    public FinderByFormId<Race> createRaceFinder() {
        return createFinder(GRUP_TYPE.RACE);
    }

    public FinderByFormId<Texture> createTextureFinder() {
        return createFinder(GRUP_TYPE.TXST);
    }

    public FinderByFormId<Perk> createPerkFinder() {
        return createFinder(GRUP_TYPE.PERK);
    }

    public FinderByFormId<Spell> createSpellFinder() {
        return createFinder(GRUP_TYPE.SPEL);
    }

    public FinderByFormId<Dialog> createDialogFinder() {
        return createFinder(GRUP_TYPE.DIAL);
    }

    public FinderByFormId<DialogBranch> createDialogBranchFinder() {
        return createFinder(GRUP_TYPE.DLBR);
    }

    public FinderByFormId<Quest> createQuestFinder() {
        return createFinder(GRUP_TYPE.QUST);
    }

    public FinderByFormId<GlobalForm> createGlobalFormFinder() {
        return createFinder(GRUP_TYPE.GLOB);
    }

    public FinderByFormId<HeadPart> createHeadPartFinder() {
        return createFinder(GRUP_TYPE.HDPT);
    }

    public FinderByFormId<Info> createInfoFinder() {
        return createFinder(GRUP_TYPE.INFO);
    }

    public FinderByFormId<NPC> createNPCFinder() {
        return createFinder(GRUP_TYPE.NPC_);
    }

    public FinderByFormId<Faction> createFactionFinder() {
        return createFinder(GRUP_TYPE.FACT);
    }

    public FinderByFormId<AIPackage> createAIPackagesFinder() {
        return new FinderByFormIDStub<AIPackage>() {
            @Override
            protected AIPackage createStub(FormID id) {
                return new AIPackageBridge(id);
            }
        };
    }

    public FinderByFormId<NPCClass> createNPCClassFinder() {
        return new FinderByFormIDStub<NPCClass>() {
            @Override
            protected NPCClass createStub(FormID id) {
                return new NPCClassBridge(id);
            }
        };
    }

    public FinderByFormId<JSkyColor> createJSkyColorFinder() {
        return new FinderByFormIDStub<JSkyColor>() {
            @Override
            protected JSkyColor createStub(FormID id) {
                return new JSkyColorBridge(id);
            }
        };
    }

    public FinderByFormId<Outfit> createOutfitFinder() {
        return createFinder(GRUP_TYPE.OTFT);
    }

    public FinderByFormId<CombatStyle> createCombatStyleFinder() {
        return new FinderByFormIDStub<CombatStyle>() {
            @Override
            protected CombatStyle createStub(FormID id) {
                return new CombatStyleBridge(id);
            }
        };
    }

    public FinderByFormId<AudioTemplate> createAudioTemplateFinder() {
        return new FinderByFormIDStub<AudioTemplate>() {
            @Override
            protected AudioTemplate createStub(FormID id) {
                return new AudioTemplateBridge(id);
            }
        };
    }

    public FinderByFormId<Major> createOutfitElementsFinder() {
        return createFinder(GRUP_TYPE.LVLI, GRUP_TYPE.ARMO);
    }

    public FinderByFormId<Projectile> createProjectileFinder() {
        return createFinder(GRUP_TYPE.PROJ);
    }

    public FinderByFormId<Light> createLightFinder() {
        throw new UnsupportedOperationException("Light unsupported");
    }

    public FinderByFormId<Explosion> createExplosionFinder() {
        return new FinderByFormIDStub<Explosion>() {
            @Override
            protected Explosion createStub(FormID id) {
                return new ExplosionBridge(id);
            }
        };
    }

    public FinderByFormId<JSkySound> createJSkySoundFinder() {
        return new FinderByFormIDStub<JSkySound>() {
            @Override
            protected JSkySound createStub(FormID id) {
                return new SoundBridge(id);
            }
        };
    }

    public FinderByFormId<VoiceType> createVoiceTypeFinder() {
        return new FinderByFormIDStub<VoiceType>() {
            @Override
            protected VoiceType createStub(FormID id) {
                return new VoiceTypeBridge(id);
            }
        };
    }

    public FinderByFormId<MaterialType> createMaterialTypeFinder() {
        return new FinderByFormIDStub<MaterialType>() {
            @Override
            protected MaterialType createStub(FormID id) {
                return new MaterialTypeBridge(id);
            }
        };
    }

    public FinderByFormId<ImpactSet> createImpactSetFinder() {
        return new FinderByFormIDStub<ImpactSet>() {
            @Override
            protected ImpactSet createStub(FormID id) {
                return new ImpactSetBridge(id);
            }
        };
    }

    public FinderByFormId<EquipSlot> createEquipSlotFinder() {
        return new FinderByFormIDStub<EquipSlot>() {
            @Override
            protected EquipSlot createStub(FormID id) {
                return new EquipSlotBridge(id);
            }
        };
    }

    public FinderByFormId<StaticObject> createStaticObjectFinder() {
        return new FinderByFormIDStub<StaticObject>() {
            @Override
            protected StaticObject createStub(FormID id) {
                return new StaticObjectBridge(id);
            }
        };
    }

    public FinderByFormId<Addiction> createAddictionFinder() {
        return new FinderByFormIDStub<Addiction>() {
            @Override
            protected Addiction createStub(FormID id) {
                return new AddictionBridge(id);
            }
        };
    }

    public FinderByFormId<FirstPersonModel> createFirstPersonModelFinder() {
        return new FinderByFormIDStub<FirstPersonModel>() {
            @Override
            protected FirstPersonModel createStub(FormID id) {
                return new FirstPersonModelBridge(id);
            }
        };
    }

    public FinderByFormId<CritEffect> createCritEffectFinder() {
        return new FinderByFormIDStub<CritEffect>() {
            @Override
            protected CritEffect createStub(FormID id) {
                return new CritEffectBridge(id);
            }
        };
    }

    public FinderByFormId<Skill> createSkillFinder() {
        return new FinderByFormIDStub<Skill>() {
            @Override
            protected Skill createStub(FormID id) {
                return new SkillBridge(id);
            }
        };
    }

    public FinderByFormId<Art> createArtFinder() {
        return new FinderByFormIDStub<Art>() {
            @Override
            protected Art createStub(FormID id) {
                return new ArtBridge(id);
            }
        };
    }

    public FinderByFormId<GameLocation> createGameLocationFinder() {
        return new FinderByFormIDStub<GameLocation>() {
            @Override
            protected GameLocation createStub(FormID id) {
                return new GameLocationBridge(id);
            }
        };
    }

    public FinderByFormId<ResponseData> createResponseDataFinder() {
        return new FinderByFormIDStub<ResponseData>() {
            @Override
            protected ResponseData createStub(FormID id) {
                return new ResponseDataBridge(id);
            }
        };
    }

    public FinderByFormId<Animation> createAnimationFinder() {
        return new FinderByFormIDStub<Animation>() {
            @Override
            protected Animation createStub(FormID id) {
                return new AnimationBridge(id);
            }
        };
    }

    public FinderByFormId<EffectShader> createEffectShaderFinder() {
        return new FinderByFormIDStub<EffectShader>() {
            @Override
            protected EffectShader createStub(FormID id) {
                return new EffectShaderBridge(id);
            }
        };
    }

    public FinderByFormId<DualCastArt> createDualCastArtFinder() {
        return new FinderByFormIDStub<DualCastArt>() {
            @Override
            protected DualCastArt createStub(FormID id) {
                return new DualCastArtBridge(id);
            }
        };
    }

    public FinderByFormId<ImageSpaceMod> createImageSpaceModFinder() {
        return new FinderByFormIDStub<ImageSpaceMod>() {
            @Override
            protected ImageSpaceMod createStub(FormID id) {
                return new ImageSpaceModBridge(id);
            }
        };
    }

    public FinderByFormId<Ammo> createAmmoFinder() {
        return createFinder(GRUP_TYPE.AMMO);
    }

    public FinderByFormId<Potion> createPotionFinder() {
        return createFinder(GRUP_TYPE.ALCH);
    }

    public FinderByFormId<Book> createBookFinder() {
        return createFinder(GRUP_TYPE.BOOK);
    }

    public FinderByFormId<Recipe> createRecipeFinder() {
        return createFinder(GRUP_TYPE.COBJ);
    }

    public FinderByFormId<Container> createContainerFinder() {
        return createFinder(GRUP_TYPE.CONT);
    }

    public FinderByFormId<EncounterZone> createEncounterZoneFinder() {
        return createFinder(GRUP_TYPE.ECZN);
    }

    public FinderByFormId<ImageSpace> createImageSpaceFinder() {
        return createFinder(GRUP_TYPE.IMGS);
    }

    public FinderByFormId<Ingredient> createIngredientFinder() {
        return createFinder(GRUP_TYPE.INGR);
    }

    public FinderByFormId<LeveledCharacter> createLeveledCharacterFinder() {
        return createFinder(GRUP_TYPE.LVLN);
    }

    public FinderByFormId<MagicEffect> createMagicEffectFinder() {
        return createFinder(GRUP_TYPE.MGEF);
    }

    public FinderByFormId<Miscellaneous> createMiscellaneousFinder() {
        return createFinder(GRUP_TYPE.MISC);
    }

    public FinderByFormId<Scroll> createScrollFinder() {
        return createFinder(GRUP_TYPE.SCRL);
    }

    public FinderByFormId<LeveledItemList> createLeveledItemListFinder() {
        return createFinder(GRUP_TYPE.LVLI);
    }

    public FinderByFormId<GameSetting> createGameSettingFinder() {
        return createFinder(GRUP_TYPE.GMST);
    }

    public FinderByFormId<ActorValue> createActorValueFinder() {
        return createFinder(GRUP_TYPE.AVIF);
    }

    public FinderByFormId<DialogView> createDialogViewFinder() {
        return createFinder(GRUP_TYPE.DLVW);
    }

}
